#pragma once

#ifndef _RESOURCES_MANAGER_H_
#define _RESOURCES_MANAGER_H_

//Inclusiones basicas
#include "wingmotor.h"

//Inclusiones estandar
#include <list>
#include <string>

//Inclusiones de libreria
#include "ResourceGroup.h"
#include "Register.h"

//Dependencias
#include <StdTools/LogManager.h>
#include <StdTools/Thread.h>

namespace GMotor
{
	/**
	* Esta clase se encarga de manejar los recursos (cargarlos,descargarlos,etc.)
	*/
#ifdef WIN
	class GMOTOR_API ResourcesManager : public StdTools::Threads::Runnable
#else
	class ResourcesManager : public StdTools::Threads::Runnable
#endif
	{
	private:
		StdTools::Threads::Thread * thread;

	protected:
		StdTools::LogManager * mLogManager;
		std::list<ResourceGroup *> lstResourceGroup;
		std::list<Register *> lstRegister;

	public:
		ResourcesManager(StdTools::LogManager * logManager);
		virtual ~ResourcesManager(void);

		//Getters y Setters
		Resource * getResource(std::string name);

		void addRegister(Register * newRegister);
		void addResource(std::string path, std::string group="General");
		void deleteResource(std::string name);
		void deleteGroup(std::string name);

		void initializeAll();
		void initializeGroup();
		void uninitializeAll();
		void uninitializeGroup();

		//Metodos de la clase Runnable
		void Run();
	};
}
#endif